import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

export default new Router({
  mode: "history",
  base: process.env.BASE_URL,
  routes: [
    {
      path: "/",
      name: "home",
      component: resolve => {
        // 这个特殊的 `require` 语法将会告诉 webpack
        // 自动将你的构建代码切割成多个包，这些包
        // 会通过 Ajax 请求加载
        require(["@/views/Home"], resolve);
      }
    },
    {
      path: "/about",
      name: "about",
      component: resolve => {
        require(["@/views/About"], resolve);
      }
    },
    {
      path: "/login",
      name: "login",
      component: resolve => {
        require(["@/views/login/Index"], resolve);
      }
    }
  ]
});
